Repository navigation
Conversation
lizaixi01
force-pushed
the
feat/editor-2-manual-mode-basics
branch
from
November 30, 2026 05:16
1110bac to
c1deff6
Compare
DECISION: the Chinese translation table uses the SolidWorks Chinese terms wherever the editor named the same thing differently (基准面, 完全定义/欠定义/过定义, 几何关系/尺寸, 镜向, 构造几何线, 拉伸凸台/拉伸切除, 移动面, 简单直孔, 边线, and 配合 for assembly joints). Only words a person reads change; the SDK, the notebook code, the table's keys and everything an agent reads stay as they are. WHY (discussion of 2026-11-29 between the user and the assistant; record: design-docs/editor-sw-terms.md): the user, learning CAD through the editor's manual mode and SolidWorks videos side by side, compared the two term by term and kept looking for the SolidWorks word and not finding it (工作平面 for a 基准面, 已求解 for 完全定义, 约束 for 几何关系 and 尺寸, 镜像 for 镜向). The people this manual mode is for learned CAD on SolidWorks. The user's judgement: rename so that everything a person reads matches SolidWorks as far as possible, as its own branch, while the kernel stays the agent-friendly tool it is. Words only, so no code path changes. ALTERNATIVE CONSIDERED AND REJECTED: replacing "约束" and "边" everywhere. 约束 also names assembly joints, which SolidWorks calls 配合, and 边 occurs inside other words (边界, 两边); both were changed key by key instead. 基本体 is kept: SolidWorks has no primitives, so there is no word to copy. WHAT CHANGES: editor-web/src/i18n/locales/zh-CN.json, 73 values (no key added, removed or reordered). Behaviour that differs from SolidWorks (pick-kind chips instead of hover selection, connectors instead of face mates, no rollback bar) is not touched here. Checked: `vitest run src/i18n` (3 passed: every key the source uses has a Chinese entry, interpolations kept) and `tsc --noEmit` in this branch, on origin/master. Seen in the running editor on the working branch: the pick chips read 边线, a picked face offers 简单直孔. Not checked: every dialog that shows the renamed words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: keep the term-by-term table of the change "editor i18n: the Chinese UI names things the way SolidWorks does" as a design record, so that a later reader sees which words changed, which were kept on purpose (基本体, 组件) and that behaviour differences are a separate matter. WHY: the decision is about words only, and its reasons are not visible from the diff of a translation table; the repo's rule is that a decision that outlives one commit gets a record in design-docs/. WHAT CHANGES: design-docs/editor-sw-terms.md (new; design-docs/ is git-ignored, added with -f). Checked: the table matches the 73 values the previous commit changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lizaixi01
force-pushed
the
feat/editor-2-manual-mode-basics
branch
from
November 30, 2026 06:15
c1deff6 to
a1de216
Compare
NiJingzhe
requested changes
Nov 30, 2026
NiJingzhe
left a comment
Collaborator
There was a problem hiding this comment.
整体实现非常扎实(_applying 修复 undo/redo cell id 追踪、exported_file 白名单下载、纯函数模块与单测都很干净)。有 3 个小边界问题建议修复后再合并:
- 非 ASCII 文件名可能导致导出下载报 500(
src/simplecadapi/editor/server.pyexported_file):
headers={"Content-Disposition": f'attachment; filename="{path.name}"'}在 notebook 文件名包含中文等非 ASCII 字符时,HTTP 头按 latin-1 编码可能会抛出UnicodeEncodeError。建议使用 RFC 5987(提供 ASCII fallback +filename*=UTF-8''...)。 - 导出失败错误信息截断方向反了(
src/simplecadapi/editor/server.py):
f"{suffix[1:].upper()} export failed: {error}"[-300:]取了末尾 300 字符,当error较长时会把开头的"STEP export failed: "截掉,建议改为[:300]。 - 关闭导出弹窗后旧的保存状态残留(
editor-web/src/components/ExportDialog.tsx):
setSaved({})只在Dialog的onOpenChange里执行,底部Close按钮直接调用了onClose,未清空saved,下次再导出打开弹窗时仍会残留上次的"Saved where you chose."提示。
SolidWorks' Chinese help says 零部件 throughout (插入零部件, 零部件属性); the table mixed it with 组件 (review of PhySpace#102). The wording note said both were SolidWorks' words; it now lists 零部件 with the other terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…AL_MODE=1 DECISION: MANUAL_MODE stays off in a release, and `VITE_MANUAL_MODE=1` (for `npm run dev` or a build) turns it on. WHY (work with the user on the editor's human interface, 2026-11-27 to 11-29): the user learns CAD through the editor's manual mode and improves it, so it had to run without editing the constant every time and without the risk of committing it switched on. The release keeps the code mode only, as the comment of this file says, until manual mode has a plan of its own. ALTERNATIVE CONSIDERED AND REJECTED: flipping the constant to true locally (it is one stray commit away from shipping). WHAT CHANGES: editor-web/src/lib/manual-mode.ts. Nothing else reads the variable; without it the editor is as before. Checked: tsc --noEmit and vitest run (331 passed) in editor-web, on this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: while an undo or redo applies its steps, those steps stay reachable by _rename, so a cell id that changes during the apply (a deleted cell brought back gets a new id) is updated in them too. WHY (found by the user on 2026-11-28: "为什么我撤销重做几次居然会报错,点不了了"): undo and redo pop the steps off both stacks before applying them. An undo that brings back a deleted cell renames its id in the stacks, but the steps being applied were on neither stack at that moment, so they kept the old id; the next redo then looked for a cell that no longer existed and failed, and every later undo or redo failed with it. WHAT CHANGES: src/simplecadapi/editor/gui_features.py (FeatureService._applying, used by undo, redo and _rename). Checked: the editor tests (test_editor_features.py) pass at the end of this series; at this commit only tsc and vitest were run (331 passed). Seen in the running editor: undoing and redoing several times no longer fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s undo and redo DECISION: when the person keeps a value tuned on a slider (the editor rewrites the params cell), the undo history takes the new code as that cell's code (FeatureService.follow), so undo and redo go on from it. An edit made in the code itself is not followed: undoing over that is still refused, never forced. WHY (the user, 2026-11-28, after dragging a slider and pressing undo): the history remembered the params cell's code from when the feature was made, so after a slider change undo said the code had been changed elsewhere and stopped. A slider is part of the GUI, not an edit somewhere else; the refusal is meant for edits in code, which must not be overwritten. ALTERNATIVE CONSIDERED AND REJECTED: recording each slider change as an undo step of its own (the slider already has its own reset, and one drag would fill the history). WHAT CHANGES: gui_features.py (follow), server.py (_commit calls it with each changed cell's old and new code), and the test test_numbers_tuned_on_the_sliders_and_kept_do_not_break_undo_and_redo. Checked: test_editor_features.py at the end of this series (see the last commit); tsc and vitest on this commit (331 passed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: the left panel's content box clips (overflow-clip) instead of hiding overflow, so it cannot be scrolled. WHY (seen on 2026-11-28): a panel that was not shown still got focus, and the box holding both scrolled sideways by 156 px, so the tree appeared cut off at the left. overflow-hidden still lets a box scroll by focus; overflow-clip does not. WHAT CHANGES: one class in editor-web/src/App.tsx. Checked: tsc and vitest on this commit (331 passed); in the running editor the tree no longer shifts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and offers save as
DECISION: the header has an Export button; export writes the package and, next to it, STEP and STL (each on its own, so
one failing keeps the other), then a dialog shows the folder, a copy button, and "Save as…" for each file (the browser's
save dialog, or a download where that is not allowed).
WHY (the user, 2026-11-27: "导出成功了,但是不知道导出到哪了…就像另存为一样"): the export only wrote a status line with a
path. A person exports to take the model elsewhere (another CAD program, a slicer), which needs STEP or STL and needs to
know where the file is.
WHAT CHANGES: components/ExportDialog.tsx (new), Header.tsx (button), App.tsx (state), server.py (_export writes STEP and
STL and remembers the files; GET /api/export/file/{name} serves only those names), Chinese strings.
Checked: tsc and vitest on this commit (334 passed); exported in the running editor; the save dialog falls back to a
download in the embedded browser, where it is refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bers, names, plain failures) DECISION: what a person reads about the steps says what it means, in their language, with the program's own words kept out of the way: steps are numbered 1, 2, 3 in order; a step is named by its operation (Box → 方块, numbered when repeated) or by a `# 名称:…` line in its code, with a second line from `# 说明:…` or "builds on «X»"; a failed step says "«X» did not work" and what to try, with the SDK's message folded under Details; the reference check is shown only when a reference is actually lost; the partial-model notice names the step; the header drops ".py" and translates the kind; slider labels are plain words. The role and "product" badges leave the tree. WHY (the user, 2026-11-27: "主界面英文太多了看不懂…要做爸妈,老板能看懂的产品…每个功能最简单地话要解释清楚", and on 2026-11-28 about the tree: the numbers in front were cell indexes with gaps, and "产品" was not a word anyone recognised): the tree showed code names (slug, role, reads -> makes), cell indexes and raw SDK errors. The product badge was looked up first: in a chain of steps the part is the last step, as in any feature tree; when it is not, the banner above the list already says so and offers the choice (design-docs/part-holds-one-solid.md), so the badge added nothing. ALTERNATIVE CONSIDERED AND REJECTED: translating the slugs (they are code names an agent uses; the name in the code stays in the tooltip). WHAT CHANGES: FeatureTree.tsx, lib/plain-label.ts (new, with tests), Header.tsx, ParamControl.tsx (labels), PartialModel.tsx, lib/features.ts (title/note, a translated candidate label), App.tsx (step names for the notice, remade on a language change), gui_features.py (feature_words reads the two comment lines into the snapshot), Chinese strings. Nothing an agent reads changes. Checked: tsc and vitest on this commit (339 passed); seen in the running editor in Chinese with a failed shell step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he pick DECISION: in the feature tree, a click on the row that is already picked, or on the empty part of the list, clears the pick (Ctrl/Cmd keeps adding and removing as before). WHY (the user, 2026-11-28: "按草图点击左边区域是无法取消选中的"): once a sketch row was picked there was no way to unpick it from the tree, which every file list and feature tree allows. WHAT CHANGES: lib/tree-click.ts (new, with tests: the decision as a pure function), FeatureTree.tsx (onSelect takes null). Checked: tsc and vitest on this commit (343 passed); tried in the running editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: ParamControl shows the number box by default (editable = true); a caller that wants a bare slider passes false. WHY (the user, 2026-11-28: "这个拖动应该改成可以输入,这样更方便"): a person who knows the number (a 40 mm plate) types it rather than drags to it; the box existed but only in the operation panel. WHAT CHANGES: the default of one prop in components/ParamControl.tsx. Checked: tsc and vitest on this commit (343 passed); typed values in the running editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… picks: distance and angle) DECISION: the inspector shows for each picked item what it is and its measures (a plane face's area and normal, a cylinder's diameter, an edge's length…), with a copy button for each number; for two picks it shows the distance between parallel faces, the angle, the centre distance and the offsets, for more the totals. The ids and raw properties stay, folded under "Details (for the AI and developers)". While an item's details load it shows nothing rather than "nothing to measure". WHY (the user, 2026-11-28: "检查器里的东西也非常看不懂,都是英文,我想先看看 onshape 或者 sw 是怎么做的"): the inspector listed entity ids and a JSON tree. SolidWorks' Measure tool and Onshape's measure panel show the measures of the picked geometry and, for two picks, the distance and angle between them; that is what a person picks things to find out. WHAT CHANGES: lib/measure.ts (new, pure, 9 tests), components/Inspector.tsx, Chinese strings. Checked: tsc and vitest on this commit (352 passed); picked faces and edges of a flange in the running editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stay on screen DECISION: the inspector (by its header) and the notice under it (anywhere on it) can be dragged; where each was put is remembered in this browser, two quick presses put it back, and a card is always kept at least partly on screen (also when a remembered place no longer fits the window). A drag the system breaks off ends. WHY (the user, 2026-11-29: "我希望这两个框能拖动,要不然就会像现在这样挤成一堆"): the inspector, the partial-model notice and the AI panel sat in the same corner and covered each other. The code review of 2026-11-29 found that a card could be dragged out of reach for good and that a cancelled drag never ended; both are handled here. ALTERNATIVE CONSIDERED AND REJECTED: reusing lib/useDraggable.ts, which centres dialogs and has a different contract. WHAT CHANGES: lib/useFloatingDrag.ts (new; clampToView is pure and tested), FloatingPanels.tsx, the inspector header as the handle. Checked: tsc and vitest on this commit (355 passed); in the running editor a card placed off screen came back on reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nese in the library's source The library carries no Chinese (test_library_is_english). The tags `# 名称:` and `# 说明:` are still read, written as \u escapes, and `# name:` / `# note:` work as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lizaixi01
force-pushed
the
feat/editor-2-manual-mode-basics
branch
from
December 1, 2026 03:39
a1de216 to
061f1d9
Compare
…87 filename*)
DECISION: GET /api/export/file/{name} sends Content-Disposition as an ASCII filename plus filename*=UTF-8''<quoted>
(server._attachment).
WHY: HTTP headers are Latin-1; a part named in Chinese (法兰.step) made the header fail to encode and the page's
"save as" answer 500 (review of PhySpace#103 by NiJingzhe, point 1).
Checked: ExportedFileTest in test_editor.py (a 法兰.step download: 200, the bytes, an ASCII header with the
filename* form).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iled: …") DECISION: the status line of a failed STEP/STL export is cut to its first 300 characters, not its last. WHY: with a long error the cut dropped "STEP export failed:", so the page said what went wrong without saying it was the export (review of PhySpace#103 by NiJingzhe, point 2). Checked: python -m py_compile; the line is the same otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… saved DECISION: every way out of the export dialog (its Close button, Esc, a click outside) goes through one close that clears the "Saved where you chose." notes. WHY: only the dialog's own onOpenChange cleared them; the Close button called onClose directly, so the next export showed the last one's notes (review of PhySpace#103 by NiJingzhe, point 3). Checked: tsc in editor-web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
谢谢!三处都改了,各一个提交:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manual mode basics
VITE_MANUAL_MODE=1switches manual mode on for development (it stays off in a release).# 名称:, failures in plain words with the SDK's message folded away; clicking the picked row or the empty list clears the pick; every slider has a number box.Commits of this part: from
editor: manual mode can be switched on for development with VITE_MANUAL_MODE=1tofix(editor): closing the export dialog by its button forgets what was saved(15 commits).Part 2 of 6 of the editor's manual-mode work, split by theme so each can be reviewed on its own (it replaces #101, which had all of it in one PR). The parts build on each other: merge them in order 1 → 6. Until the parts before this one are merged, this PR also shows their commits; the commits that belong to this part are listed above.
Every commit holds one decision and its reasons (AGENT.md). The series was reordered by theme after it was written; the "Checked" line of a commit describes the check made when it was written, and the tip of every part was checked again after the reordering (below). Manual mode stays off in a release;
VITE_MANUAL_MODE=1turns it on for development (part 2).Checked at the tip of this part:
tsc --noEmitandvitest runineditor-web;pytest test/test_editor_features.py test/test_editor.py test/test_editor_workplanes.py(andtest_editor_agent_requests.pyfrom part 3 on), run withPYTHONPATHset to the absolutesrcpath; the editor tests needhttpx, which the dev group locks. Results: tsc ok; vitest 352 passed; pytest 152 passed, 5 skipped.🤖 Generated with Claude Code